CSharpTest.Net
ReplaceStorage Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Collections Namespace > SynchronizedDictionary<TKey,TValue> Class : ReplaceStorage Method

newStorage

Glossary Item Box

Locks the collection and replaces the underlying storage dictionary.

Syntax

Visual Basic (Declaration) 
Public Function ReplaceStorage( _
   ByVal newStorage As IDictionary(Of TKey,TValue) _
) As IDictionary(Of TKey,TValue)

Parameters

newStorage

Example

Library/Library.Test/TestSynchronizedCollections.cs

C#Copy Code
SynchronizedDictionary<string, string> test = new SynchronizedDictionary<string, string>(StringComparer.Ordinal, new IgnoreLocking());
test["a"] = "b";
Assert.AreEqual(1, test.Count);
test.ReplaceStorage(new Dictionary<string, string>());
Assert.AreEqual(0, test.Count);
VB.NETCopy Code
Dim test As New SynchronizedDictionary(Of String, String)(StringComparer.Ordinal, New IgnoreLocking())
test("a") = "b"
Assert.AreEqual(1, test.Count)
test.ReplaceStorage(New Dictionary(Of String, String)())
Assert.AreEqual(0, test.Count)

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys